#pragma once

#include <QMainWindow>
#include <QVBoxLayout>
#include "bookmarkbar.h"
#include "toolbar.h"
#include "tabbar.h"
#include "webview.h"

class MainWindow : public QMainWindow
{
	Q_OBJECT
public:
	explicit MainWindow(QWidget *parent = 0);
	void init(void);
signals:
	void needTab(unsigned index);
	void needSaveTab(int index, BookmarkItem *bookmark);
	void needCreateTab(TabItem *tab);
	void needRemoveTab(int index);
public slots:
	void openBookmark(BookmarkItem *bookmark, Qt::MouseButton button);
	void slot_urlChanged(QString url);
	void showSelectedTab(TabItem *tab);
	void showBookmarks(QVector<BookmarkItem*> *bookmarks);
	void createTab(TabItem *tab);
	void emit_needRemoveTab(int index);
private slots:
	void emit_needTab(int index);
	void emit_needCreateTab(int index);
private:
	void openUrl(BookmarkItem *bookmark);
	QWidget *widget;
	ToolBar *toolBar;
	BookmarkBar *bookmarkBar;
	TabBar *tabBar;
	WebView *view;
	QVBoxLayout *layout;
};
